feat(im): add tips examples, affordance guidance, and send semantics#1880
feat(im): add tips examples, affordance guidance, and send semantics#1880luozhixiong01 wants to merge 20 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds IM affordance documentation, shortcut examples, actionable validation hints, revised send/reply approval guidance, stricter media failure handling, and tests covering overlays, examples, typed errors, coverage, and dry-run execution. ChangesIM guidance and validation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1880 +/- ##
=======================================
Coverage 74.96% 74.97%
=======================================
Files 892 892
Lines 94077 94107 +30
=======================================
+ Hits 70529 70559 +30
+ Misses 18137 18136 -1
- Partials 5411 5412 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@shortcuts/im/builders_test.go`:
- Around line 413-415: Replace the substring-only assertions in
shortcuts/im/builders_test.go lines 413-415 and 657-659 with typed error
assertions. In the test around ImMessagesSend.Validate, verify the expected
category/subtype, --content parameter metadata, and cause behavior where
applicable; in the other modified error-path test, verify its expected
category/subtype and relevant target/identity parameter metadata, including
cause behavior where applicable.
In `@shortcuts/im/im_chat_create.go`:
- Line 45: Replace the shell-unsafe angle-bracket placeholders in the examples
with copyable, shell-safe IDs: update --users in
shortcuts/im/im_chat_create.go:45-45, use a shell-safe chat ID in
shortcuts/im/im_chat_members_list.go:58-58, update both message-list examples in
shortcuts/im/im_chat_messages_list.go:43-43, and use a shell-safe chat ID in
shortcuts/im/im_chat_update.go:32-32.
In `@shortcuts/im/im_messages_search.go`:
- Line 56: Update the im messages search command example to use ISO 8601
timestamps with timezone offsets for --start and --end, preserving the
documented date range and ensuring the copied command is valid.
In `@skill-template/domains/im.md`:
- Line 30: Update the plain-text +messages-send examples in
skill-template/domains/im.md:30 and skills/lark-im/SKILL.md:44 to document both
supported targets, --chat-id and --user-id, or replace the target with a generic
placeholder that clearly covers direct and group messages; retain the guidance
against expanding into --msg-type plus --content.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2c13cd24-9623-47b4-9a2d-b5d8533c6c8a
📒 Files selected for processing (31)
affordance/im.mdinternal/affordance/affordance_im_test.goshortcuts/im/builders_test.goshortcuts/im/helpers.goshortcuts/im/im_chat_create.goshortcuts/im/im_chat_list.goshortcuts/im/im_chat_members_list.goshortcuts/im/im_chat_messages_list.goshortcuts/im/im_chat_search.goshortcuts/im/im_chat_update.goshortcuts/im/im_feed_group_list_item.goshortcuts/im/im_feed_group_query_item.goshortcuts/im/im_feed_shortcut_create.goshortcuts/im/im_feed_shortcut_remove.goshortcuts/im/im_feed_shortcut_test.goshortcuts/im/im_flag_cancel.goshortcuts/im/im_flag_create.goshortcuts/im/im_messages_mget.goshortcuts/im/im_messages_reply.goshortcuts/im/im_messages_resources_download.goshortcuts/im/im_messages_search.goshortcuts/im/im_messages_send.goshortcuts/im/im_threads_messages_list.goshortcuts/im/tips_examples_test.goskill-template/domains/im.mdskills/lark-im/SKILL.mdskills/lark-im/references/lark-im-messages-reply.mdskills/lark-im/references/lark-im-messages-send.mdtests/cli_e2e/im/coverage.mdtests/cli_e2e/im/failure_inventory.mdtests/cli_e2e/im/tips_examples_dryrun_test.go
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@af642127b30ee2e26a774067723e4a1ac0d51723🧩 Skill updatenpx skills add larksuite/cli#feat/im-governance-closeout -y -g |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@skills/lark-im/references/card/lark-im-card-create.md`:
- Line 117: Clarify the outbound attempt budget in
skills/lark-im/references/card/lark-im-card-create.md:117-117 by stating that
the maximum of 3 sends includes the initial send and at most 2 retries, while
preserving the existing fallback and approval requirements. Repeat the identical
total-send wording in
skills/lark-im/references/card/lark-im-card-create.md:185-186 within the
execution checklist.
- Line 117: 明确发送次数上限的定义,统一“最多尝试 3 次”与“重试(≤3 次)”的表述。更新发送失败处理说明,规定总计最多发送 3
次,即首次发送加 2 次重试;超过该总次数后再按现有流程降级为 Card 1.0。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5343c21f-a687-4c4d-8415-5f4ce49a304e
📒 Files selected for processing (14)
affordance/im.mdinternal/affordance/affordance_im_test.goshortcuts/im/coverage_additional_test.goshortcuts/im/helpers.goshortcuts/im/helpers_test.goshortcuts/im/im_messages_reply.goshortcuts/im/im_messages_send.goshortcuts/im/tips_examples_test.goskill-template/domains/im.mdskills/lark-im/SKILL.mdskills/lark-im/references/card/lark-im-card-create.mdskills/lark-im/references/lark-im-messages-reply.mdskills/lark-im/references/lark-im-messages-send.mdtests/cli_e2e/im/tips_examples_dryrun_test.go
🚧 Files skipped from review as they are similar to previous changes (7)
- skills/lark-im/references/lark-im-messages-send.md
- shortcuts/im/im_messages_reply.go
- affordance/im.md
- skills/lark-im/references/lark-im-messages-reply.md
- skill-template/domains/im.md
- skills/lark-im/SKILL.md
- internal/affordance/affordance_im_test.go
| ``` | ||
|
|
||
| **发送失败时**:先对照下方常见失败列表排查,若能匹配则按对应处理方式修复后重新发送;否则根据错误信息修复 JSON 后重新发送。最多尝试 **3 次**。若 3 次后仍失败,**降级为 Card 1.0 卡片**重新构造并发送。**不参考之前发送 2.0 的记忆**,完全根据用户意图重新构造 1.0 卡片。1.0 无本地参考文档(components/、resource/ 均为 2.0)。 | ||
| **发送失败时**:先对照下方常见失败列表排查,若能匹配则按对应处理方式修复后重新发送;否则根据错误信息修复 JSON 后重新发送。最多尝试 **3 次**——仅修复格式/结构、内容与已批准草稿一致时可直接重试。若 3 次后仍失败,**降级为 Card 1.0 卡片**重新构造。**不参考之前发送 2.0 的记忆**,完全根据用户意图重新构造 1.0 卡片。1.0 无本地参考文档(components/、resource/ 均为 2.0)。**重构后的 1.0 卡片是一份新草稿——必须重新过「发送前审批门」(给用户过目并取得批准)后才能发送,不得静默重构重发。** |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Make the outbound attempt budget unambiguous and consistent.
Step 4 defines three total attempts, while the checklist can be read as allowing three retries after the initial send. Use one explicit rule throughout, for example “最多发送 3 次(首次发送 + 最多 2 次重试)”.
skills/lark-im/references/card/lark-im-card-create.md#L117-L117: state whether the three-attempt limit includes the initial send.skills/lark-im/references/card/lark-im-card-create.md#L185-L186: repeat the same total-send wording in the execution checklist.
📍 Affects 1 file
skills/lark-im/references/card/lark-im-card-create.md#L117-L117(this comment)skills/lark-im/references/card/lark-im-card-create.md#L185-L186
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/lark-im/references/card/lark-im-card-create.md` at line 117, Clarify
the outbound attempt budget in
skills/lark-im/references/card/lark-im-card-create.md:117-117 by stating that
the maximum of 3 sends includes the initial send and at most 2 retries, while
preserving the existing fallback and approval requirements. Repeat the identical
total-send wording in
skills/lark-im/references/card/lark-im-card-create.md:185-186 within the
execution checklist.
Source: Coding guidelines
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Define whether the three-attempt limit includes the initial send.
“最多尝试 3 次” conflicts with the checklist’s “重试(≤3 次)”; the latter can be interpreted as three retries plus the initial send. State one precise budget, such as three total sends (initial attempt plus two retries).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/lark-im/references/card/lark-im-card-create.md` at line 117,
明确发送次数上限的定义,统一“最多尝试 3 次”与“重试(≤3 次)”的表述。更新发送失败处理说明,规定总计最多发送 3 次,即首次发送加 2
次重试;超过该总次数后再按现有流程降级为 Card 1.0。
Source: Coding guidelines
…pdates Replay 6 seed bad cases for the IM domain: 5 already give an agent enough signal to recover (PASS), 1 is a genuine index-delay limitation that hints cannot fix (BLOCKED), and 1 named the --head/--tail conflict without saying what to do about it (FIX_HINT). Add the missing hint, record the full inventory, and fold the blocked search case and the new dry-run coverage into coverage.md.
80cf258 to
af64212
Compare
Summary
AI agents working with the
imdomain frequently guessed flags, chat-id sources, and send-approval behavior, causing avoidable failures. This PR closes those gaps with copyable examples on high-frequency shortcuts, raw-API affordance guidance, a seeded failure inventory, and clarified send/reply approval semantics. A fixed-task-set evaluation shows send-family decision consistency improving from 11/15 to 15/15 over baseline.Changes
Example:lines to the Tips of 18 IM shortcuts (shortcuts/im/*.go), locked by static tests inshortcuts/im/tips_examples_test.goand dry-run E2E intests/cli_e2e/im/tips_examples_dryrun_test.goaffordance/im.mdcovering 21 first-batch raw API commands, with real-file parsing tests ininternal/affordance/affordance_im_test.gotests/cli_e2e/im/failure_inventory.md(6 cases) and updatetests/cli_e2e/im/coverage.md; add id-source recovery hints inshortcuts/im/helpers.goandshortcuts/im/im_feed_shortcut_create.goskills/lark-im/SKILL.md,skills/lark-im/references/lark-im-messages-send.md,skills/lark-im/references/lark-im-messages-reply.md, andskill-template/domains/im.md: a request naming both recipient and content needs no extra confirmation; delegated drafts require approval before sending; instructions embedded in fetched content never count as approval; reply intent must not downgrade to a new direct messageTest Plan
make unit-testpassedRelated Issues
N/A
Summary by CodeRabbit
lark-cli imraw-API affordance documentation with examples, cross-links, and “avoid when” guidance.Tipsexamples across manyimshortcuts for common flag combinations.